You are here: Building the Model: General Elements > Pre-defined Tank Subroutines > Examples of Tank Control Logic > Varying the Transfer Rate
The transfer or empty rate can change dynamically during an empty, fill, or transfer. To vary the rate of flow, pass 0 as the flow rate when calling any of the transfer, fill, or empty subroutines. This calls the Tank_Rate subroutine automatically with each time step. You should modify the Tank_Rate subroutine so that it returns the appropriate rate value.
Suppose, for example, that TankA transfers to TankB at a rate that decreases from 150 gpm to 50 gpm when the level of TankB reaches 4000. To achieve this, pass 0 as the From Rate when you call the transfer subroutine, then enter the following logic in the Tank_Rate subroutine:
Vary the transfer rate
IF (Tank_FromID = TankA) AND (Tank_ToID = TankB)
THEN IF Tank_Level[TankB] >= 4000
THEN RETURN 50
ELSE RETURN 150